package org.apache.ibatis.demo;

import java.lang.reflect.Method;

/**
 * @description:
 * @projectName:mybatis
 * @see:org.apache.ibatis.demo
 * @author:Deng.Jing.Ping
 * @createTime:2022/1/13 15:32
 * @version:1.0
 */
public class MethodInvoke {

    public static void main(String[] args) throws Exception {
        Method animalMethod = Animal.class.getDeclaredMethod("print");

        Animal animal = new Animal();

        animalMethod.invoke(animal,"1");


    }

}

class Animal {

    public void print(String val) {
        System.out.println("Animal.print()"+val);
    }

    public void print() {
        System.out.println("Animal.print()");
    }

}

